# $Id: PKGBUILD 88813 2013-04-22 22:03:58Z svenstaro $
# Maintainer: Sven-Hendrik Haase <sh@lutzhaase.com>
# Contributor: William Giokas <1007380@gmail.com>

_hgrev=63547

pkgname=pypy
pkgver=2.0beta2
[[ -n $_hgrev ]] && pkgver=2.0beta2.$_hgrev
pkgrel=1
pkgdesc="A Python implementation written in Python, JIT enabled"
url="http://codespeak.net/pypy/"
arch=('i686' 'x86_64')
depends=('libffi')
provides=('python2')
options=(!buildflags)
# You can remove pypy to not make the package depend on itself here
# and use python2 in build() but it takes ages.
makedepends=('python2' 'mercurial' 'pypy')
optdepends=('openssl: openssl module'
            'expat: pyexpat module'
            'ncurses: ncurses module'
            'zlib: zlib module'
            'bzip2: bz2 module')
license=('custom:MIT')
source=("hg+https://bitbucket.org/pypy/pypy#revision=$_hgrev")
md5sums=('SKIP')

build() {
  cd "${srcdir}"/pypy/pypy/goal

  python2 ../../rpython/bin/rpython -Ojit targetpypystandalone
}

package() {
  cd "${srcdir}"/pypy/pypy/goal

  install -Dm755 pypy-c "${pkgdir}"/opt/pypy/pypy-c
  mkdir -p "${pkgdir}"/opt/pypy/{lib-python,pypy}

  cd "${srcdir}"/pypy
  cp -r lib-python/2.7 "${pkgdir}"/opt/pypy/lib-python/
  cp -r lib_pypy "${pkgdir}"/opt/pypy/
  cp -r include "${pkgdir}"/opt/pypy/

  mkdir -p "${pkgdir}"/usr/bin
  ln -s /opt/pypy/pypy-c "${pkgdir}"/usr/bin/pypy

  install -Dm644 LICENSE "${pkgdir}"/usr/share/licenses/pypy/LICENSE
}
# vim: ts=2 sw=2 et:
